﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace Streambolics.Gui
{
    public delegate void WndProcCallback (ref Message m);

    /// <summary>
    ///     An invisible form used to intercept Windows Messages.
    /// </summary>

    public class InvisibleForm : Form
    {
        public InvisibleForm()
        {
            MinimizeBox = false;
            MaximizeBox = false;
            ShowInTaskbar = false;
            ShowIcon = false;
            FormBorderStyle = FormBorderStyle.None;
        }

        public event WndProcCallback WndProcMessageArrived;

        protected override void OnLoad (EventArgs e)
        {
            base.OnLoad (e);
            this.Size = new System.Drawing.Size (5, 5);
        }

        protected override void OnActivated (EventArgs e)
        {
            base.OnActivated (e);
            Visible = false;
        }

        protected override void WndProc(ref Message m)
        {
            base.WndProc(ref m);
            if (WndProcMessageArrived != null)
            {
                WndProcMessageArrived(ref m);
            }
        }
    }
}
